package com.darrenchan.leetcode

/**
  * @Desc
  * @Author chenchi03
  * @CreateTime 2019-12-06 12:04
  */
object Q70 {
    def climbStairs(n: Int): Int = {
        if(n == 1 || n == 2) n
        else {
            val res = new Array[Int](n + 1)
            res(1) = 1
            res(2) = 2
            for(i <- 3 to n){
                res(i) = res(i - 1) + res(i - 2)
            }
            res(n)
        }
    }

    def main(args: Array[String]): Unit = {
        println(climbStairs(1))
    }
}
